// 变量x的类型是字符串hello，导致它只能赋值为这个字符串，赋值为其他字符串就会报错。
let x: "hello"
x = "hello" // 正确
// x = "world"  报错

function request(url: string, method: "get" | "post"): void {
    console.log(url, method)
}

request('https://localhost:8080', "get")


const info = {
    url: "https://localhost:8080",
    method: "get"
}

request(info.url, info.method as "get")

